# 调试容器: docker run --rm -it -v $(pwd)/app:/app dev-app /bin/sh

# 使用镜像
FROM seven45/pdm-ci:3.11-alpine

# 设置工作目录
WORKDIR /app

ENV VIRTUAL_ENV=/app/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

# 复制 package.json 和 package-lock.json
# COPY ./* /app


# 设置 npm 的全局代理配置
ENV HTTP_PROXY=http://192.168.168.20:7890
ENV HTTPS_PROXY=http://192.168.168.20:7890

# 复制应用代码
COPY . .

# RUN python clear.py

# 安装项目依赖
RUN pdm config pypi.url https://pypi.tuna.tsinghua.edu.cn/simple/
# RUN pdm init
# RUN pdm install
RUN pdm install --frozen-lockfile --no-editable
RUN pdm add tortoise-orm[asyncmy]
RUN pdm add cryptography
RUN pdm add mysql-connector-python aerich
RUN pdm add orjson

ENV LANG=zh_CN.UTF-8

# 暴露服务端口
# EXPOSE 3000

# 默认启动命令
CMD ["pdm", "run", "run.py"]
